package org.dwpd.controller.board;

import lombok.extern.slf4j.Slf4j;
import org.dwpd.domain.common.Result;
import org.dwpd.service.board.BoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/board")
@RestController
public class BoardController {

    @Autowired
    private BoardService boardService;

    /**
     * 添加留言信息
     * @param comment 留言信息
     */
    @PostMapping("/addBoardMessage")
    public Result addMessage(String comment) {
        return boardService.addMessage(comment);
    }

    /**
     * 获取所有留言信息
     */
    @GetMapping("/getAllMessage")
    public Result getAllMessage() {
        return boardService.getAllMessage();
    }

    /**
     * 删除留言信息
     * @param bmId 留言信息Id
     */
    @PostMapping("/deleteMessage")
    public Result deleteMessageByMessageId(Integer bmId) {
        return boardService.deleteMessage(bmId);
    }
}
